package com.chao.config;

//import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration // 配置类
@EnableTransactionManagement // 开启事务，默认是开启的
public class MybatisPlusConfig {

    // 乐观锁
//    @Bean
//    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
//
//        return new OptimisticLockerInterceptor();
//    }

    // 分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    // 逻辑删除  mybatis-plus 3.2.0以上不需要加逻辑删除配置
    //    @Bean
    //    public ISqlInjector sqlInjector(){
    //        return new LogicSqlInjector();
    //    }
}

